/**
 *******************************************************************************
 * @FileName  : pan108x_rcc.h
 * @Author    : GaoQiu
 * @CreateDate: 2023-08-01
 * @Copyright : Copyright(C) Panchip
 *              All Rights Reserved.
 *******************************************************************************
 *
 * The information contained herein is confidential and proprietary property of
 * Panchip and is available under the terms of Commercial License Agreement
 * between Panchip and the licensee in separate contract or the terms described
 * here-in.
 *
 * This heading MUST NOT be removed from this file.
 *
 * Licensees are granted free, non-transferable use of the information in this
 * file under Mutual Non-Disclosure Agreement. NO WARRENTY of ANY KIND is provided.
 *
 *******************************************************************************
 */

#ifndef PAN108X_RCC_H_
#define PAN108X_RCC_H_

#include "utils/defs_types.h"

#if defined(IP_108)

/*! PLL Clock Source */
#define RCC_PLLClkSrc_RCH    0
#define RCC_PLLClkSrc_XTH    1

/*! PLL Out Frequce */
#define RCC_PLLOutFreq_48M   0
#define RCC_PLLOutFreq_64M   1

/* System Clock Source */
#define RCC_SysClkSrc_RCH    0
#define RCC_SysClkSrc_XTH    1
#define RCC_SysClkSrc_PLL    2

/* 32k Clock Source */
#define RCC_32kClkSrc_RCL    0
#define RCC_32kClkSrc_XTL    1

#elif defined(IP_107)
/*! PLL Clock Source */
#define RCC_PLLClkSrc_RCH    0
#define RCC_PLLClkSrc_XTH    1

/*! PLL Out Frequce */
#define RCC_PLLOutFreq_48M   0
#define RCC_PLLOutFreq_64M   1

/* System Clock Source */
#define RCC_SysClkSrc_RCH    0
#define RCC_SysClkSrc_XTH    1
#define RCC_SysClkSrc_PLL    2

/* 32k Clock Source */
#define RCC_32kClkSrc_RCL    0
#define RCC_32kClkSrc_XTL    1

#endif

void SysClkInit(void);
void LoadCalibrationInfo(void);

void RCC_Wait3VSync(void);

void RCC_XTHPowerOn(void);
void RCC_RCHPowerOn(void);
void RCC_PLLPowerOn(uint8_t PLLClkSrc, uint8_t PLLOutFreq);
void RCC_RCLPowerOn(void);
void RCC_XTLPowerOn(void);


void RCC_SetSysClkSrc(uint8_t sysClkSrc);
void RCC_Set32kClkSrc(uint8_t clk32kSrc);

#endif /* PAN108X_RCC_H_ */
